package app

import (
	"go.uber.org/fx"
	"go.uber.org/fx/fxevent"
	"go.uber.org/zap"
)

func New() fx.Option {
	return fx.Options(
		newModule(),
		fx.WithLogger(func(logger *zap.Logger) fxevent.Logger {
			return &fxevent.ZapLogger{Logger: logger}
		}),
	)
}

func newModule() fx.Option {
	return fx.Module("App",
		newConfig(),
		newLogger(),
		newGreeter(),
		newRpc(),
		newNats(),
		newUpgrader(),
		newEmitter(),
		newHttp(),
	)
}
